<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: zhangjx
 * @Date: 2023-05-23 14:08:35
 * @LastEditors: zhangjx
 * @LastEditTime: 2023-05-23 14:16:41
-->
<template>
	<div></div>
</template>
<script setup lang="ts" name="Redirect">
const { currentRoute, replace } = useRouter()
const { params, query } = unref(currentRoute)
const { path, _redirect_type = 'path' } = params

Reflect.deleteProperty(params, '_redirect_type')
Reflect.deleteProperty(params, 'path')

const _path = Array.isArray(path) ? path.join('/') : path

if (_redirect_type === 'name') {
	replace({
		name: _path,
		query,
		params,
	})
} else {
	replace({
		path: _path.startsWith('/') ? _path : '/' + _path,
		query,
	})
}
</script>
